/*
 * Copyright 2007-2008, www.jsemantic.org, www.adolfoestevez.com,
 * http://semanticj2ee.blogspot.com/ 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jsemantic.core.mock;

import java.util.ArrayList;
import java.util.Collection;

import org.jsemantic.core.session.SemanticException;

/**
 * The Class StatelessMockRuleSession.
 */
public class StatelessMockRuleSession implements MockRuleSession {
	
	/** The Constant log. */
	public static final org.apache.log4j.Logger log = org.apache.log4j.Logger
	.getLogger(StatelessMockRuleSession.class);
	
	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#dispose()
	 */
	public void dispose() {
		if (log.isInfoEnabled()) {
			log.info("Session disposed");
		}
		
	}

	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#execute(java.lang.Object)
	 */
	public Collection execute(Object o) {
		Collection results = new ArrayList();
		results.add("Result 1");
		results.add("Result 2");
		return results;
	}

	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#execute(java.util.Collection)
	 */
	public Collection execute(Collection o) {
		Collection results = new ArrayList();
		results.add("Result C1");
		results.add("Result C2");
		return results;
	}

	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#fireAllRules()
	 */
	public void fireAllRules() throws SemanticException {
		if (log.isInfoEnabled()) {
			log.info("Rules Fired.");
		}
		
	}

	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#insert(java.lang.Object)
	 */
	public Object insert(Object fact) {
		return this.execute(fact);
	}

	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#insert(java.util.Collection)
	 */
	public Collection insert(Collection facts) {
		return this.execute(facts);
	}

	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#modifyInsert(java.lang.Object, java.lang.Object)
	 */
	public void modifyInsert(Object handle, Object arg) {
		if (log.isInfoEnabled()) {
			log.info("Operation not allowed");
		}
		
	}

	/* (non-Javadoc)
	 * @see org.jsemantic.core.MockRuleSession#modifyRetract(java.lang.Object)
	 */
	public void modifyRetract(Object handle) {
		if (log.isInfoEnabled()) {
			log.info("Operation not allowed");
		}
	}

}
